package com.bruce.starts.demo.commonerror.transaction.demo;

import org.springframework.transaction.TransactionStatus;

import java.util.List;
import java.util.Map;

public class BatchTransactionPoolTask implements Runnable{
    private final ThreadExecution execution;
    private final List<?> list;
    private final ThreadExecutionService executionService;
    private final Map<Long, TransactionStatus> longTransactionStatusMap;

    private final BatchTransactionInfo info;

    public BatchTransactionPoolTask(ThreadExecution execution, List<?> list, ThreadExecutionService executionService, Map<Long, TransactionStatus> longTransactionStatusMap, BatchTransactionInfo info) {
        this.execution = execution;
        this.list = list;
        this.executionService = executionService;
        this.longTransactionStatusMap = longTransactionStatusMap;
        this.info = info;
    }

    @Override
    public void run() {
        executionService.executeBatch(execution,list,longTransactionStatusMap,info);
    }
}
